class Category < ActiveRecord::Base

  acts_as_nested_set :scope => :user_id

  has_many :payee_mappings
  has_many :entries
  belongs_to :user

  def full_name
    level > 1 ? self_and_ancestors.slice(1..-1).collect(&:name).join(':') : name
  end

  def expense?
    root.name == "Expense"
  end

  def income?
    root.name == "Income"
  end

end
